﻿/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page2={
    create:function () {
    var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        var bg=Easy.CreateSprite('assets/images/page_bg.png',0,0,0,0,1);
        page.ui.addChild(bg);

        var i0=Easy.CreateSprite('assets/images/p2_i0.png',369,142,0.5,0.5,0);
        page.ui.addChild(i0);

        var i1=Easy.CreateSprite('assets/images/p2_i1.png',369,319,0.5,0.5,0);
        page.ui.addChild(i1);

        var i2=Easy.CreateSprite('assets/images/p2_i2.png',101,306,0.0,0.0,0);
        page.ui.addChild(i2);
        TweenMax.to(i2,30,{x:-502,repeat:-1,yoyo:true,repeatDelay:1,ease:Linear.easeNone});
        var i2_mask=new PIXI.Graphics();
        i2_mask.beginFill(0x0,1);
        i2_mask.drawRect(0,0,542,466);
        i2_mask.endFill();
        i2_mask.x=99;
        i2_mask.y=425;
        page.ui.addChild(i2_mask);
        i2.mask=i2_mask;

        var i3=Easy.CreateSprite('assets/images/p2_i3.png',369,935,0.5,0.5,0);
        page.ui.addChild(i3);

        var tip=Easy.CreateSprite('assets/images/tip.png',370,1105,0.5,0.5,1);
        TweenMax.to(tip,1,{repeat:-1,yoyo:true,y:1105+30,alpha:0.7,ease:Cubic.easeInOut});
        page.ui.addChild(tip);

        var bt_locate=Easy.CreateSprite('assets/images/bt_locate.png',pixiStage.x+740,1020,1,0.5,1);
        bt_locate.interactive=true;
        page.ui.addChild(bt_locate);
        bt_locate.on('pointerdown',function()
        {
            showMap();
        });

        page.In=function () {
            i0.x=370+150;
            i0.alpha=0;
            TweenMax.to(i0,1,{delay:0.2*0,x:370,alpha:1,ease:Back.easeOut});

            i1.x=370-150;
            i1.alpha=0;
            TweenMax.to(i1,1,{delay:0.2*1,x:370,alpha:1,ease:Back.easeOut});

            i2.alpha=0;
            TweenMax.to(i2,1,{delay:0.2*2,alpha:1,ease:Back.easeOut});
            i2_mask.x=101+150;
            TweenMax.to(i2_mask,1,{delay:0.2*3,x:99,alpha:1,ease:Back.easeOut});

            i3.x=370-150;
            i3.alpha=0;
            TweenMax.to(i3,1,{delay:0.2*4,x:370,alpha:1,ease:Back.easeOut});
        }
        page.Out=function()
        {
            TweenMax.killTweensOf(i0);
            TweenMax.killTweensOf(i1);
            // TweenMax.killTweensOf(i2);
            TweenMax.killTweensOf(i3);
            TweenMax.killTweensOf(i2_mask);
            
            TweenMax.to(page.ui,0.3,{alpha:1,onComplete:function () {
                page.ui.alpha=1;
                i0.alpha=0;
                i1.alpha=0;
                i2.alpha=0;
                i3.alpha=0;
                i2_mask.x=101+150;
            }})
        }

    return page;
    }
}